@@ -1,100 +0,0 @@
-use strict;
-use Module::Build;
-use File::Spec;
-
-my $class = Module::Build->subclass(
- class => "Module::Build::WikiDoc",
- code => <<'SUBCLASS', );
-
- sub ACTION_code {
- my $self = shift;
- $self->SUPER::ACTION_code;
- $self->depends_on('share');
- }
-
- sub ACTION_share {
- my $self = shift;
- my $blib = $self->blib;
- my @dist_names = split "/-/", $self->dist_name;
- my $autodir = File::Spec->catdir($blib, 'lib', 'auto', @dist_names);
- File::Path::mkpath( $autodir );
- for my $f ( @{ $self->rscan_dir( 'scripts', '.' ) } ) {
- next if $f eq 'scripts';
- my $to = File::Spec->abs2rel( $f, 'scripts' );
- $self->copy_if_modified(
- from => $f,
- to => File::Spec->catfile( $autodir, $to ),
- verbose => 1
- );
- }
- }
-
- sub ACTION_wikidoc {
- my $self = shift;
- eval "use Pod::WikiDoc";
- if ( $@ eq '' ) {
- my $parser = Pod::WikiDoc->new( {
- comment_blocks => 1,
- keywords => { VERSION => $self->dist_version },
- });
- for my $src ( keys %{ $self->find_pm_files() } ) {
- (my $tgt = $src) =~ s{\.pm$}{.pod};
- $parser->filter( {
- input => $src,
- output => $tgt,
- });
- print "Creating $tgt\n";
- $tgt =~ s{\\}{/}g;
- $self->_add_to_manifest( 'MANIFEST', $tgt );
- }
- }
- else {
- warn "Pod::WikiDoc not available. Skipping wikidoc.\n";
- }
- }
-
- sub ACTION_test {
- my $self = shift;
- my $missing_pod;
- for my $src ( keys %{ $self->find_pm_files() } ) {
- (my $tgt = $src) =~ s{\.pm$}{.pod};
- $missing_pod = 1 if ! -e $tgt;
- }
- if ( $missing_pod ) {
- $self->depends_on('wikidoc');
- $self->depends_on('build');
- }
- $self->SUPER::ACTION_test;
- }
-
- sub ACTION_testpod {
- my $self = shift;
- $self->depends_on('wikidoc');
- $self->SUPER::ACTION_testpod;
- }
-
- sub ACTION_distdir {
- my $self = shift;
- $self->depends_on('wikidoc');
- $self->SUPER::ACTION_distdir;
- }
-
-SUBCLASS
-
-$class->new(
- module_name => 'Tee',
- dist_author => 'David A. Golden <dagolden@cpan.org>',
- license => 'perl',
- create_readme => 1,
-# create_makefile_pl => 'traditional',
- requires => {
- # module requirements here
- 'File::Basename' => 0,
- 'File::Spec' => 0,
- 'Getopt::Long' => 2.32,
- 'IPC::Run3' => 0.033,
- 'Probe::Perl' => 0,
- 'Test::More' => 0.45, # thread-safe
- },
- script_files => [ 'scripts/ptee' ],
-)->create_build_script;
@@ -1,5 +1,24 @@
Revision history for Perl module Tee
+0.14 2011-01-28 09:40:36 EST5EDT
+
+ [BUG FIXES]
+
+ - fix error writing to undef handle on MSWin32 in some circumstances
+
+ [OTHER]
+
+ - converted distribution to Dist::Zilla
+
+0.13_51 Thu Dec 11 00:48:32 EST 2008
+
+ - moved guts of ptee to Tee::App; removed ptee search logic from Tee.pm
+
+ - bumped some prerequisites; dropped others
+
+ - changed to the Apache License, version 2.0; (it's clearer, relicensable,
+ and is explicit about contributions)
+
0.13 Thu Aug 17 13:09:03 EDT 2006
- customize Makefile.PL for auto/Tee
- handle spaces in ptee path in Tee.pm
@@ -1,18 +0,0 @@
-INSTALLATION
-
-If Module::Build is installed (preferred):
-
- perl Build.PL
- perl Build
- perl Build test
- perl Build install
-
-Otherwise, using a Makefile:
-
- perl Makefile.PL
- make
- make test
- make install
-
-If you are on a windows box you should use 'dmake' or 'nmake' rather than
-'make'.
@@ -1,383 +1,207 @@
-Terms of Perl itself
-
-a) the GNU General Public License as published by the Free
- Software Foundation; either version 1, or (at your option) any
- later version, or
-b) the "Artistic License"
-
----------------------------------------------------------------------------
-
-The General Public License (GPL)
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave,
-Cambridge, MA 02139, USA. Everyone is permitted to copy and distribute
-verbatim copies of this license document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it. By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users. This General Public License applies to most of
-the Free Software Foundation's software and to any other program whose
-authors commit to using it. (Some other Free Software Foundation software is
-covered by the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price. Our
-General Public Licenses are designed to make sure that you have the freedom
-to distribute copies of free software (and charge for this service if you wish), that
-you receive source code or can get it if you want it, that you can change the
-software or use pieces of it in new free programs; and that you know you can do
-these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights. These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for a
-fee, you must give the recipients all the rights that you have. You must make
-sure that they, too, receive or can get the source code. And you must show
-them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2) offer
-you this license which gives you legal permission to copy, distribute and/or
-modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software. If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced by
-others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents. We wish
-to avoid the danger that redistributors of a free program will individually obtain
-patent licenses, in effect making the program proprietary. To prevent this, we
-have made it clear that any patent must be licensed for everyone's free use or
-not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification
-follow.
-
-GNU GENERAL PUBLIC LICENSE
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND
-MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License. The "Program", below, refers to any such program
-or work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or translated
-into another language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope. The act of running the Program is not
-restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program). Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and appropriately
-publish on each copy an appropriate copyright notice and disclaimer of warranty;
-keep intact all the notices that refer to this License and to the absence of any
-warranty; and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may at
-your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such
-modifications or work under the terms of Section 1 above, provided that you also
-meet all of these conditions:
-
-a) You must cause the modified files to carry prominent notices stating that you
-changed the files and the date of any change.
-
-b) You must cause any work that you distribute or publish, that in whole or in
-part contains or is derived from the Program or any part thereof, to be licensed
-as a whole at no charge to all third parties under the terms of this License.
-
-c) If the modified program normally reads commands interactively when run, you
-must cause it, when started running for such interactive use in the most ordinary
-way, to print or display an announcement including an appropriate copyright
-notice and a notice that there is no warranty (or else, saying that you provide a
-warranty) and that users may redistribute the program under these conditions,
-and telling the user how to view a copy of this License. (Exception: if the
-Program itself is interactive but does not normally print such an announcement,
-your work based on the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License,
-and its terms, do not apply to those sections when you distribute them as
-separate works. But when you distribute the same sections as part of a whole
-which is a work based on the Program, the distribution of the whole must be on
-the terms of this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your rights to
-work written entirely by you; rather, the intent is to exercise the right to control
-the distribution of derivative or collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may copy and distribute the Program (or a work based on it, under
-Section 2) in object code or executable form under the terms of Sections 1 and 2
-above provided that you also do one of the following:
-
-a) Accompany it with the complete corresponding machine-readable source
-code, which must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange; or,
-
-b) Accompany it with a written offer, valid for at least three years, to give any
-third party, for a charge no more than your cost of physically performing source
-distribution, a complete machine-readable copy of the corresponding source
-code, to be distributed under the terms of Sections 1 and 2 above on a medium
-customarily used for software interchange; or,
-
-c) Accompany it with the information you received as to the offer to distribute
-corresponding source code. (This alternative is allowed only for noncommercial
-distribution and only if you received the program in object code or executable
-form with such an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for making
-modifications to it. For an executable work, complete source code means all the
-source code for all modules it contains, plus any associated interface definition
-files, plus the scripts used to control compilation and installation of the
-executable. However, as a special exception, the source code distributed need
-not include anything that is normally distributed (in either source or binary form)
-with the major components (compiler, kernel, and so on) of the operating system
-on which the executable runs, unless that component itself accompanies the
-executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source
-code from the same place counts as distribution of the source code, even though
-third parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License. Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License. However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so long
-as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works. These actions are prohibited by law if you do not accept
-this License. Therefore, by modifying or distributing the Program (or any work
-based on the Program), you indicate your acceptance of this License to do so,
-and all its terms and conditions for copying, distributing or modifying the
-Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to copy,
-distribute or modify the Program subject to these terms and conditions. You
-may not impose any further restrictions on the recipients' exercise of the rights
-granted herein. You are not responsible for enforcing compliance by third parties
-to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent infringement
-or for any other reason (not limited to patent issues), conditions are imposed on
-you (whether by court order, agreement or otherwise) that contradict the
-conditions of this License, they do not excuse you from the conditions of this
-License. If you cannot distribute so as to satisfy simultaneously your obligations
-under this License and any other pertinent obligations, then as a consequence
-you may not distribute the Program at all. For example, if a patent license would
-not permit royalty-free redistribution of the Program by all those who receive
-copies directly or indirectly through you, then the only way you could satisfy
-both it and this License would be to refrain entirely from distribution of the
-Program.
-
-If any portion of this section is held invalid or unenforceable under any particular
-circumstance, the balance of the section is intended to apply and the section as
-a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or other
-property right claims or to contest validity of any such claims; this section has
-the sole purpose of protecting the integrity of the free software distribution
-system, which is implemented by public license practices. Many people have
-made generous contributions to the wide range of software distributed through
-that system in reliance on consistent application of that system; it is up to the
-author/donor to decide if he or she is willing to distribute software through any
-other system and a licensee cannot impose that choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain countries
-either by patents or by copyrighted interfaces, the original copyright holder who
-places the Program under this License may add an explicit geographical
-distribution limitation excluding those countries, so that distribution is permitted
-only in or among countries not thus excluded. In such case, this License
-incorporates the limitation as if written in the body of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time. Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems or
-concerns.
-
-Each version is given a distinguishing version number. If the Program specifies a
-version number of this License which applies to it and "any later version", you
-have the option of following the terms and conditions either of that version or of
-any later version published by the Free Software Foundation. If the Program does
-not specify a version number of this License, you may choose any version ever
-published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission. For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of all
-derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS
-NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE
-COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM
-"AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
-IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
-CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED
-TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY
-WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS
-PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
-ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM
-(INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
-OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-
----------------------------------------------------------------------------
-
-The Artistic License
-
-Preamble
-
-The intent of this document is to state the conditions under which a Package
-may be copied, such that the Copyright Holder maintains some semblance of
-artistic control over the development of the package, while giving the users of the
-package the right to use and distribute the Package in a more-or-less customary
-fashion, plus the right to make reasonable modifications.
-
-Definitions:
-
-- "Package" refers to the collection of files distributed by the Copyright
- Holder, and derivatives of that collection of files created through textual
- modification.
-- "Standard Version" refers to such a Package if it has not been modified,
- or has been modified in accordance with the wishes of the Copyright
- Holder.
-- "Copyright Holder" is whoever is named in the copyright or copyrights for
- the package.
-- "You" is you, if you're thinking about copying or distributing this Package.
-- "Reasonable copying fee" is whatever you can justify on the basis of
- media cost, duplication charges, time of people involved, and so on. (You
- will not be required to justify it to the Copyright Holder, but only to the
- computing community at large as a market that must bear the fee.)
-- "Freely Available" means that no fee is charged for the item itself, though
- there may be fees involved in handling the item. It also means that
- recipients of the item may redistribute it under the same conditions they
- received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you duplicate
-all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications derived from
-the Public Domain or from the Copyright Holder. A Package modified in such a
-way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and when
-you changed that file, and provided that you do at least ONE of the following:
-
- a) place your modifications in the Public Domain or otherwise
- make them Freely Available, such as by posting said modifications
- to Usenet or an equivalent medium, or placing the modifications on
- a major archive site such as ftp.uu.net, or by allowing the
- Copyright Holder to include your modifications in the Standard
- Version of the Package.
-
- b) use the modified Package only within your corporation or
- organization.
-
- c) rename any non-standard executables so the names do not
- conflict with standard executables, which must also be provided,
- and provide a separate manual page for each non-standard
- executable that clearly documents how it differs from the Standard
- Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or executable
-form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library
- files, together with instructions (in the manual page or equivalent)
- on where to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their
- corresponding Standard Version executables, giving the
- non-standard executables non-standard names, and clearly
- documenting the differences in manual pages (or equivalent),
- together with instructions on where to get the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this Package.
-You may charge any fee you choose for support of this Package. You may not
-charge a fee for this Package itself. However, you may distribute this Package in
-aggregate with other (possibly commercial) programs as part of a larger
-(possibly commercial) software distribution provided that you do not advertise
-this Package as a product of your own.
-
-6. The scripts and library files supplied as input to or produced as output from
-the programs of this Package do not automatically fall under the copyright of this
-Package, but belong to whomever generated them, and may be sold
-commercially, and may be aggregated with this Package.
-
-7. C or perl subroutines supplied by you and linked into this Package shall not
-be considered part of this Package.
-
-8. Aggregation of this Package with a commercial distribution is always permitted
-provided that the use of this Package is embedded; that is, when no overt attempt
-is made to make this Package's interfaces visible to the end user of the
-commercial distribution. Such use shall not be construed as a distribution of
-this Package.
-
-9. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written permission.
-
-10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.
-
-The End
-
-
+This software is Copyright (c) 2006 by David Golden.
+
+This is free software, licensed under:
+
+ The Apache License, Version 2.0, January 2004
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
@@ -1,20 +1,23 @@
-Build.PL
Changes
-INSTALL
-lib/Tee.pm
-lib/Tee.pod
LICENSE
-Makefile.PL
MANIFEST
-MANIFEST.SKIP
+META.json
META.yml
+Makefile.PL
README
-scripts/ptee
+Todo
+bin/ptee
+dist.ini
+lib/Tee.pm
+lib/Tee/App.pm
+t/00-compile.t
t/01_Tee.t
t/02_tee_script.t
t/03_tee_function.t
-t/98_pod.t
-t/99_pod-coverage.t
t/Expected.pm
+t/fatality.pl
t/helloworld.pl
-Todo
+xt/release/distmeta.t
+xt/release/pod-coverage.t
+xt/release/pod-syntax.t
+xt/release/portability.t
@@ -1,29 +0,0 @@
-# Version control files and dirs.
-\bRCS\b
-\bCVS\b
-,v$
-.svn/
-
-# ExtUtils::MakeMaker generated files and dirs.
-^MANIFEST\.(?!SKIP)
-^Makefile$
-^blib/
-^blibdirs$
-^PM_to_blib$
-^MakeMaker-\d
-
-# Module::Build
-^Build$
-^_build
-.bat$
-
-# Coverage
-^cover_db
-
-# Temp, old, vi and emacs files.
-~$
-\.old$
-^#.*#$
-^\.#
-\.swp$
-\.bak$
@@ -0,0 +1,74 @@
+{
+ "abstract" : "Pure Perl emulation of GNU tee",
+ "author" : [
+ "David Golden <dagolden@cpan.org>"
+ ],
+ "dynamic_config" : 0,
+ "generated_by" : "Dist::Zilla version 4.200001, CPAN::Meta::Converter version 2.102400",
+ "license" : [
+ "apache_2_0"
+ ],
+ "meta-spec" : {
+ "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ "version" : "2"
+ },
+ "name" : "Tee",
+ "no_index" : {
+ "directory" : [
+ "t",
+ "xt",
+ "examples",
+ "corpus"
+ ],
+ "package" : [
+ "DB"
+ ]
+ },
+ "prereqs" : {
+ "configure" : {
+ "requires" : {
+ "ExtUtils::MakeMaker" : "6.31"
+ }
+ },
+ "runtime" : {
+ "requires" : {
+ "Exporter" : 0,
+ "File::Basename" : 0,
+ "Getopt::Long" : 0,
+ "IO::File" : 0,
+ "Probe::Perl" : 0,
+ "perl" : "5.006"
+ }
+ },
+ "test" : {
+ "requires" : {
+ "File::Find" : 0,
+ "File::Spec" : 0,
+ "File::Temp" : 0,
+ "IO::CaptureOutput" : 0,
+ "Test::More" : 0
+ }
+ }
+ },
+ "provides" : {
+ "Tee" : {
+ "file" : "lib/Tee.pm",
+ "version" : "0.14"
+ },
+ "Tee::App" : {
+ "file" : "lib/Tee/App.pm",
+ "version" : "0.14"
+ }
+ },
+ "release_status" : "stable",
+ "resources" : {
+ "homepage" : "http://github.com/dagolden/tee/tree",
+ "repository" : {
+ "type" : "git",
+ "url" : "git://github.com/dagolden/tee.git",
+ "web" : "http://github.com/dagolden/tee/tree"
+ }
+ },
+ "version" : "0.14"
+}
+
@@ -1,24 +1,45 @@
---
-name: Tee
-version: 0.13
+abstract: 'Pure Perl emulation of GNU tee'
author:
- - 'David A. Golden <dagolden@cpan.org>'
-abstract: Pure Perl emulation of GNU tee
-license: perl
-resources:
- license: http://dev.perl.org/licenses/
-requires:
- File::Basename: 0
+ - 'David Golden <dagolden@cpan.org>'
+build_requires:
+ File::Find: 0
File::Spec: 0
- Getopt::Long: 2.32
- IPC::Run3: 0.033
- Probe::Perl: 0
- Test::More: 0.45
+ File::Temp: 0
+ IO::CaptureOutput: 0
+ Test::More: 0
+configure_requires:
+ ExtUtils::MakeMaker: 6.31
+dynamic_config: 0
+generated_by: 'Dist::Zilla version 4.200001, CPAN::Meta::Converter version 2.102400'
+license: apache
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: Tee
+no_index:
+ directory:
+ - t
+ - xt
+ - examples
+ - corpus
+ package:
+ - DB
provides:
Tee:
file: lib/Tee.pm
- version: 0.13
-generated_by: Module::Build version 0.2804
-meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.2.html
- version: 1.2
+ version: 0.14
+ Tee::App:
+ file: lib/Tee/App.pm
+ version: 0.14
+requires:
+ Exporter: 0
+ File::Basename: 0
+ Getopt::Long: 0
+ IO::File: 0
+ Probe::Perl: 0
+ perl: 5.006
+resources:
+ homepage: http://github.com/dagolden/tee/tree
+ repository: git://github.com/dagolden/tee.git
+version: 0.14
@@ -1,37 +1,63 @@
-# CUSTOM WRITTEN MAKEFILE.PL -- NOT AUTOGENERATED
-use ExtUtils::MakeMaker;
-WriteMakefile
-(
- 'PL_FILES' => {},
- 'INSTALLDIRS' => 'site',
- 'NAME' => 'Tee',
- 'EXE_FILES' => [
- 'scripts/ptee'
- ],
- 'VERSION_FROM' => 'lib/Tee.pm',
- 'PREREQ_PM' => {
- 'Test::More' => '0.45',
- 'Getopt::Long' => '2.32',
- 'Probe::Perl' => 0,
- 'File::Spec' => 0,
- 'IPC::Run3' => '0.033',
- 'File::Basename' => 0
- }
- )
-;
-
-{
-package MY;
-sub postamble {
-
-return <<'HERE';
-pure_all :: $(INST_AUTODIR)/ptee
-
-$(INST_AUTODIR)/ptee: scripts/ptee
- $(CP) scripts/ptee $(INST_AUTODIR)/ptee
-
-HERE
+use strict;
+use warnings;
+
+BEGIN { require 5.006; }
+
+use ExtUtils::MakeMaker 6.31;
+
+
+
+my %WriteMakefileArgs = (
+ 'ABSTRACT' => 'Pure Perl emulation of GNU tee',
+ 'AUTHOR' => 'David Golden <dagolden@cpan.org>',
+ 'BUILD_REQUIRES' => {
+ 'File::Find' => '0',
+ 'File::Spec' => '0',
+ 'File::Temp' => '0',
+ 'IO::CaptureOutput' => '0',
+ 'Test::More' => '0'
+ },
+ 'CONFIGURE_REQUIRES' => {
+ 'ExtUtils::MakeMaker' => '6.31'
+ },
+ 'DISTNAME' => 'Tee',
+ 'EXE_FILES' => [
+ 'bin/ptee'
+ ],
+ 'LICENSE' => 'apache',
+ 'NAME' => 'Tee',
+ 'PREREQ_PM' => {
+ 'Exporter' => '0',
+ 'File::Basename' => '0',
+ 'Getopt::Long' => '0',
+ 'IO::File' => '0',
+ 'Probe::Perl' => '0'
+ },
+ 'VERSION' => '0.14',
+ 'test' => {
+ 'TESTS' => 't/*.t'
+ }
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
+ my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
+ my $pp = $WriteMakefileArgs{PREREQ_PM};
+ for my $mod ( keys %$br ) {
+ if ( exists $pp->{$mod} ) {
+ $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
+ }
+ else {
+ $pp->{$mod} = $br->{$mod};
+ }
+ }
}
-}
+
+delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
+ unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
+
+WriteMakefile(%WriteMakefileArgs);
+
+
@@ -2,14 +2,14 @@ NAME
Tee - Pure Perl emulation of GNU tee
VERSION
- This documentation refers to version 0.13
+ version 0.14
SYNOPSIS
# from Perl
use Tee;
tee( $command, @files );
-
- # from the command line
+
+ # from the command line
$ cat README.txt | ptee COPY.txt
DESCRIPTION
@@ -62,47 +62,19 @@ SEE ALSO
BUGS
Please report any bugs or feature using the CPAN Request Tracker. Bugs
- can be submitted by email to "bug-Tee@rt.cpan.org" or through the web
- interface at <http://rt.cpan.org/Public/Dist/Display.html?Name=Tee>
+ can be submitted through the web interface at
+ <http://rt.cpan.org/Dist/Display.html?Queue=Tee>
When submitting a bug or request, please include a test-file or a patch
to an existing test-file that illustrates the bug or desired feature.
AUTHOR
- David A. Golden (DAGOLDEN)
+ David Golden <dagolden@cpan.org>
- dagolden@cpan.org
+COPYRIGHT AND LICENSE
+ This software is Copyright (c) 2006 by David Golden.
- http://www.dagolden.org/
+ This is free software, licensed under:
-COPYRIGHT AND LICENSE
- Copyright (c) 2006 by David A. Golden
-
- This program is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.
-
- The full text of the license can be found in the LICENSE file included
- with this module.
-
-DISCLAIMER OF WARRANTY
- BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
- FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
- OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
- PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
- EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
- ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
- YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
- NECESSARY SERVICING, REPAIR, OR CORRECTION.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
- WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
- REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
- TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
- CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
- SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
- RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
- FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
- SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGES.
+ The Apache License, Version 2.0, January 2004
@@ -1,7 +1,3 @@
-TODO list for Perl module Tee
-
-- test tee() with multiple files
-
-- have Tee create a temporary ptee if it can't find one!
-
+Todo for Tee
+- nothing right now
@@ -0,0 +1,84 @@
+#!/usr/bin/perl
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+package
+ ptee;
+# ABSTRACT: emulate the GNU tee program with Perl
+
+use strict;
+use Tee::App qw/run/;
+run;
+
+
+
+=pod
+
+=head1 NAME
+
+ptee - emulate the GNU tee program with Perl
+
+=head1 VERSION
+
+version 0.14
+
+=head1 SYNOPSIS
+
+ ptee [OPTIONS]... [FILENAMES]...
+
+ OPTIONS:
+
+ --append or -a
+ append to file(s) rather than overwrite
+
+ --help or -h
+ give usage information
+
+ --version or -V
+ print the version number of this program
+
+=head1 DESCRIPTION
+
+C<ptee> is a pure Perl emulation of the standard GNU tool C<tee> and is
+designed to be a platform independent replacement for operating systems without
+a native C<tee> program.
+
+It passes input received on STDIN through to STDOUT while also writing a copy
+of the input to any files provided as arguments. By default, files will be
+overwritten, but this behavior may be altered with the C<--append> option.
+
+Unlike C<tee>, C<ptee> does not support ignoring interrupts, as signal handling
+is not sufficiently portable.
+
+=head1 BUGS
+
+Please report any bugs or feature using the CPAN Request Tracker.
+Bugs can be submitted through the web interface at
+L<http://rt.cpan.org/Dist/Display.html?Queue=Tee>
+
+When submitting a bug or request, please include a test-file or a patch to an
+existing test-file that illustrates the bug or desired feature.
+
+=head1 AUTHOR
+
+David Golden <dagolden@cpan.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2006 by David Golden.
+
+This is free software, licensed under:
+
+ The Apache License, Version 2.0, January 2004
+
+=cut
+
+
+__END__
+
@@ -0,0 +1,9 @@
+name = Tee
+author = David Golden <dagolden@cpan.org>
+license = Apache_2_0
+copyright_holder = David Golden
+copyright_year = 2006
+
+[@DAGOLDEN]
+git_remote = github
+
@@ -0,0 +1,160 @@
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+use strict;
+use warnings;
+package Tee::App;
+BEGIN {
+ $Tee::App::VERSION = '0.14';
+}
+# ABSTRACT: Implementation of ptee
+
+use Exporter ();
+use File::Basename qw/basename/;
+use Getopt::Long;
+use IO::File;
+our @ISA = 'Exporter';
+our @EXPORT = qw/run/;
+
+#--------------------------------------------------------------------------#
+# define help text
+#--------------------------------------------------------------------------#
+
+my $help_text = <<'END_HELP';
+
+ ptee [OPTIONS]... [FILENAMES]...
+
+ OPTIONS:
+
+ --append or -a
+ append to file(s) rather than overwrite
+
+ --help or -h
+ give usage information
+
+ --version or -V
+ print the version number of this program
+
+END_HELP
+
+$help_text =~ s/\A.+?( ptee.*)/$1/ms;
+
+sub run {
+
+ #--------------------------------------------------------------------------#
+ # process command line
+ #--------------------------------------------------------------------------#
+
+ my %opts;
+ GetOptions( \%opts,
+ 'version|V',
+ 'help|h|?',
+ 'append|a',
+ );
+
+ #--------------------------------------------------------------------------#
+ # options
+ #--------------------------------------------------------------------------#
+
+ if ($opts{version}) {
+ print basename($0), " $main::VERSION\n";
+ exit 0;
+ }
+
+ if ($opts{help}) {
+ print "Usage:\n$help_text";
+ exit 1;
+ }
+
+ my $mode = $opts{append} ? ">>" : ">";
+
+ #--------------------------------------------------------------------------#
+ # Setup list of filehandles
+ #--------------------------------------------------------------------------#
+
+ my @files;
+
+ for my $file ( @ARGV ) {
+ my $f = IO::File->new("$mode $file")
+ or die "Could't open '$file' for writing: $!'";
+ push @files, $f;
+ }
+
+ #--------------------------------------------------------------------------#
+ # Tee input to the filehandle list
+ #--------------------------------------------------------------------------#
+
+ my $buffer_size = 1024;
+ my $buffer;
+
+ while ( sysread( STDIN, $buffer, $buffer_size ) > 0 ) {
+ syswrite STDOUT, $buffer;
+ for my $fh ( @files ) {
+ syswrite $fh, $buffer;
+ }
+ }
+ return;
+}
+
+1;
+
+
+
+=pod
+
+=head1 NAME
+
+Tee::App - Implementation of ptee
+
+=head1 VERSION
+
+version 0.14
+
+=head1 DESCRIPTION
+
+Guts of the C<<< ptee >>> command.
+
+=for Pod::Coverage run
+
+=head1 SEE ALSO
+
+=over
+
+=item *
+
+L<ptee>
+
+=back
+
+=head1 BUGS
+
+Please report any bugs or feature using the CPAN Request Tracker.
+Bugs can be submitted through the web interface at
+L<http://rt.cpan.org/Dist/Display.html?Queue=Tee>
+
+When submitting a bug or request, please include a test-file or a patch to an
+existing test-file that illustrates the bug or desired feature.
+
+=head1 AUTHOR
+
+David Golden <dagolden@cpan.org>
+
+=head1 COPYRIGHT AND LICENSE
+
+This software is Copyright (c) 2006 by David Golden.
+
+This is free software, licensed under:
+
+ The Apache License, Version 2.0, January 2004
+
+=cut
+
+
+__END__
+
@@ -1,52 +1,38 @@
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+use strict;
+use warnings;
package Tee;
+BEGIN {
+ $Tee::VERSION = '0.14';
+}
+# ABSTRACT: Pure Perl emulation of GNU tee
-$VERSION = "0.13";
-@ISA = qw (Exporter);
-@EXPORT = qw (tee);
-
-use strict;
use Exporter ();
-use File::Spec;
use Probe::Perl;
-# use warnings; # only for Perl >= 5.6
-use constant PTEE => "ptee";
+our @ISA = qw (Exporter);
+our @EXPORT = qw (tee);
#--------------------------------------------------------------------------#
# Platform independent ptee invocation
#--------------------------------------------------------------------------#
-my $p = Probe::Perl->new;
-my $perl = $p->find_perl_interpreter;
-my $ptee_cmd;
-my $to_devnull = " > " . File::Spec->devnull . " 2>&1";
-
-# On installation, we store a copy of ptee in auto/Tee so we're sure
-# to find it later without worrying about $ENV{PATH}
-
-for my $path ( @INC ) {
- my $try_ptee = File::Spec->catfile( $path, 'auto', 'Tee', PTEE );
- next unless -r $try_ptee;
- if ( $try_ptee =~ /\s/ ) {
- # protect with quotes
- $try_ptee =~ s{(.*)}{"$1"}ms;
- }
- if ( system("$try_ptee -V $to_devnull" ) == 0 ) {
- $ptee_cmd = $try_ptee;
- last;
- }
- if ( system("$perl $try_ptee -V $to_devnull") == 0 ) {
- $ptee_cmd = "$perl $try_ptee";
- last;
- }
-}
+my $perl = Probe::Perl->find_perl_interpreter;
+my $ptee_cmd = "$perl -MTee::App -e run --";
#--------------------------------------------------------------------------#
# Functions
#--------------------------------------------------------------------------#
sub tee {
- die "Couldn't find a working " . PTEE . "\n" unless $ptee_cmd;
my $command = shift;
my $options;
$options = shift if (ref $_[0] eq 'HASH');
@@ -58,130 +44,122 @@ sub tee {
1; # modules must be true
-__END__
-#--------------------------------------------------------------------------#
-# main pod documentation
-#--------------------------------------------------------------------------#
-=begin wikidoc
-= NAME
+=pod
+
+=head1 NAME
Tee - Pure Perl emulation of GNU tee
-= VERSION
+=head1 VERSION
-This documentation refers to version %%VERSION%%
+version 0.14
-= SYNOPSIS
+=head1 SYNOPSIS
- # from Perl
- use Tee;
- tee( $command, @files );
+ # from Perl
+ use Tee;
+ tee( $command, @files );
- # from the command line
- $ cat README.txt | ptee COPY.txt
+ # from the command line
+ $ cat README.txt | ptee COPY.txt
-= DESCRIPTION
+=head1 DESCRIPTION
-The {Tee} distribution provides the [ptee] program, a pure Perl emulation of
-the standard GNU tool {tee}. It is designed to be a platform-independent
-replacement for operating systems without a native {tee} program. As with
-{tee}, it passes input received on STDIN through to STDOUT while also writing a
+The C<<< Tee >>> distribution provides the L<ptee> program, a pure Perl emulation of
+the standard GNU tool C<<< tee >>>. It is designed to be a platform-independent
+replacement for operating systems without a native C<<< tee >>> program. As with
+C<<< tee >>>, it passes input received on STDIN through to STDOUT while also writing a
copy of the input to one or more files. By default, files will be overwritten.
-Unlike {tee}, {ptee} does not support ignoring interrupts, as signal handling
+Unlike C<<< tee >>>, C<<< ptee >>> does not support ignoring interrupts, as signal handling
is not sufficiently portable.
-The {Tee} module provides a convenience function that may be used in place of
-{system()} to redirect commands through {ptee}.
+The C<<< Tee >>> module provides a convenience function that may be used in place of
+C<<< system() >>> to redirect commands through C<<< ptee >>>.
-= USAGE
+=head1 USAGE
-== {tee()}
+=head2 C<<< tee() >>>
- tee( $command, @filenames );
- tee( $command, \%options, @filenames );
+ tee( $command, @filenames );
+ tee( $command, \%options, @filenames );
-Executes the given command via {system()}, but pipes it through [ptee] to copy
-output to the list of files. Unlike with {system()}, the command must be a
+Executes the given command via C<<< system() >>>, but pipes it through L<ptee> to copy
+output to the list of files. Unlike with C<<< system() >>>, the command must be a
string as the command shell is used for redirection and piping. The return
-value of {system()} is passed through, but reflects the success of
-the {ptee} command, which isn't very useful.
+value of C<<< system() >>> is passed through, but reflects the success of
+the C<<< ptee >>> command, which isn't very useful.
The second argument may be a hash-reference of options. Recognized options
include:
-* stderr -- redirects STDERR to STDOUT before piping to [ptee] (default: false)
-* append -- passes the {-a} flag to [ptee] to append instead of overwriting
+=over
+
+=item *
+
+stderr -- redirects STDERR to STDOUT before piping to L<ptee> (default: false)
+
+=item *
+
+append -- passes the C<<< -a >>> flag to L<ptee> to append instead of overwriting
(default: false)
-= LIMITATIONS
+=back
-Because of the way that {Tee} uses pipes, it is limited to capturing a single
+=head1 LIMITATIONS
+
+Because of the way that C<<< Tee >>> uses pipes, it is limited to capturing a single
input stream, either STDOUT alone or both STDOUT and STDERR combined. A good,
portable alternative for capturing these streams from a command separately is
-[IPC::Run3], though it does not allow passing it through to a terminal at the
+L<IPC::Run3>, though it does not allow passing it through to a terminal at the
same time.
-= SEE ALSO
+=head1 SEE ALSO
-* [ptee]
-* IPC::Run3
-* IO::Tee
+=over
-= BUGS
+=item *
-Please report any bugs or feature using the CPAN Request Tracker.
-Bugs can be submitted by email to {bug-Tee@rt.cpan.org} or
-through the web interface at
-[http://rt.cpan.org/Public/Dist/Display.html?Name=Tee]
+L<ptee>
-When submitting a bug or request, please include a test-file or a patch to an
-existing test-file that illustrates the bug or desired feature.
+=item *
-= AUTHOR
+IPC::Run3
-David A. Golden (DAGOLDEN)
+=item *
-dagolden@cpan.org
+IO::Tee
-http://www.dagolden.org/
+=back
-= COPYRIGHT AND LICENSE
+=head1 BUGS
-Copyright (c) 2006 by David A. Golden
+Please report any bugs or feature using the CPAN Request Tracker.
+Bugs can be submitted through the web interface at
+L<http://rt.cpan.org/Dist/Display.html?Queue=Tee>
-This program is free software; you can redistribute
-it and/or modify it under the same terms as Perl itself.
+When submitting a bug or request, please include a test-file or a patch to an
+existing test-file that illustrates the bug or desired feature.
-The full text of the license can be found in the
-LICENSE file included with this module.
+=head1 AUTHOR
+David Golden <dagolden@cpan.org>
-= DISCLAIMER OF WARRANTY
+=head1 COPYRIGHT AND LICENSE
-BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
-EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
-YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
-NECESSARY SERVICING, REPAIR, OR CORRECTION.
+This software is Copyright (c) 2006 by David Golden.
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
-LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
-OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
-THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
+This is free software, licensed under:
-=end wikidoc
+ The Apache License, Version 2.0, January 2004
=cut
+
+
+__END__
+#--------------------------------------------------------------------------#
+# main pod documentation
+#--------------------------------------------------------------------------#
+
@@ -1,142 +0,0 @@
-# Generated by Pod::WikiDoc version 0.15
-
-=pod
-
-=head1 NAME
-
-Tee - Pure Perl emulation of GNU tee
-
-=head1 VERSION
-
-This documentation refers to version 0.13
-
-=head1 SYNOPSIS
-
- # from Perl
- use Tee;
- tee( $command, @files );
-
- # from the command line
- $ cat README.txt | ptee COPY.txt
-
-=head1 DESCRIPTION
-
-The C<<< Tee >>> distribution provides the L<ptee> program, a pure Perl emulation of
-the standard GNU tool C<<< tee >>>. It is designed to be a platform-independent
-replacement for operating systems without a native C<<< tee >>> program. As with
-C<<< tee >>>, it passes input received on STDIN through to STDOUT while also writing a
-copy of the input to one or more files. By default, files will be overwritten.
-
-Unlike C<<< tee >>>, C<<< ptee >>> does not support ignoring interrupts, as signal handling
-is not sufficiently portable.
-
-The C<<< Tee >>> module provides a convenience function that may be used in place of
-C<<< system() >>> to redirect commands through C<<< ptee >>>.
-
-=head1 USAGE
-
-=head2 C<<< tee() >>>
-
- tee( $command, @filenames );
- tee( $command, \%options, @filenames );
-
-Executes the given command via C<<< system() >>>, but pipes it through L<ptee> to copy
-output to the list of files. Unlike with C<<< system() >>>, the command must be a
-string as the command shell is used for redirection and piping. The return
-value of C<<< system() >>> is passed through, but reflects the success of
-the C<<< ptee >>> command, which isn't very useful.
-
-The second argument may be a hash-reference of options. Recognized options
-include:
-
-=over
-
-=item *
-
-stderr -- redirects STDERR to STDOUT before piping to L<ptee> (default: false)
-
-=item *
-
-append -- passes the C<<< -a >>> flag to L<ptee> to append instead of overwriting
-(default: false)
-
-=back
-
-=head1 LIMITATIONS
-
-Because of the way that C<<< Tee >>> uses pipes, it is limited to capturing a single
-input stream, either STDOUT alone or both STDOUT and STDERR combined. A good,
-portable alternative for capturing these streams from a command separately is
-L<IPC::Run3>, though it does not allow passing it through to a terminal at the
-same time.
-
-=head1 SEE ALSO
-
-=over
-
-=item *
-
-L<ptee>
-
-=item *
-
-IPC::Run3
-
-=item *
-
-IO::Tee
-
-=back
-
-=head1 BUGS
-
-Please report any bugs or feature using the CPAN Request Tracker.
-Bugs can be submitted by email to C<<< bug-Tee@rt.cpan.org >>> or
-through the web interface at
-L<http://rt.cpan.org/Public/Dist/Display.html?Name=Tee>
-
-When submitting a bug or request, please include a test-file or a patch to an
-existing test-file that illustrates the bug or desired feature.
-
-=head1 AUTHOR
-
-David A. Golden (DAGOLDEN)
-
-dagolden@cpan.org
-
-http:E<sol>E<sol>www.dagolden.orgE<sol>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2006 by David A. Golden
-
-This program is free software; you can redistribute
-it andE<sol>or modify it under the same terms as Perl itself.
-
-The full text of the license can be found in the
-LICENSE file included with this module.
-
-=head1 DISCLAIMER OF WARRANTY
-
-BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS ANDE<sol>OR OTHER PARTIES
-PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
-EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
-YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
-NECESSARY SERVICING, REPAIR, OR CORRECTION.
-
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY ANDE<sol>OR
-REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
-LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
-OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
-THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-
@@ -1,157 +0,0 @@
-#!/usr/bin/perl
-
-# ptee -- perl implementation of unix tee
-$VERSION = "0.13";
-use strict;
-use File::Basename qw/basename/;
-use Getopt::Long;
-use IO::File;
-
-=head1 NAME
-
-ptee - emulate the GNU tee program with Perl
-
-=cut
-
-my $help_text = <<'=cut';
-
-=head1 SYNOPSIS
-
- ptee [OPTIONS]... [FILENAMES]...
-
- OPTIONS:
-
- --append or -a
- append to file(s) rather than overwrite
-
- --help or -h
- give usage information
-
- --version or -V
- print the version number of this program
-
-=cut
-
-$help_text =~ s/\A.+?( ptee.*)/$1/ms;
-
-#--------------------------------------------------------------------------#
-# process command line
-#--------------------------------------------------------------------------#
-
-my %opts;
-GetOptions( \%opts,
- 'version|V',
- 'help|h|?',
- 'append|a',
-);
-
-#--------------------------------------------------------------------------#
-# options
-#--------------------------------------------------------------------------#
-
-if ($opts{version}) {
- print basename($0), " $main::VERSION\n";
- exit 0;
-}
-
-if ($opts{help}) {
- print "Usage:\n$help_text";
- exit 1;
-}
-
-my $mode = $opts{append} ? ">>" : ">";
-
-#--------------------------------------------------------------------------#
-# Setup list of filehandles
-#--------------------------------------------------------------------------#
-
-my $stdout = IO::Handle->new->fdopen(fileno(STDOUT),"w");
-my @files = $stdout;
-
-for my $file ( @ARGV ) {
- my $f = IO::File->new("$mode $file")
- or die "Could't open '$file' for writing: $!'";
- push @files, $f;
-}
-
-#--------------------------------------------------------------------------#
-# Tee input to the filehandle list
-#--------------------------------------------------------------------------#
-
-my $buffer_size = 1024;
-my $buffer;
-
-while ( sysread( STDIN, $buffer, $buffer_size ) > 0 ) {
- for my $fh ( @files ) {
- syswrite $fh, $buffer;
- }
-}
-
-__END__
-
-=head1 DESCRIPTION
-
-C<ptee> is a pure Perl emulation of the standard GNU tool C<tee> and is
-designed to be a platform independent replacement for operating systems without
-a native C<tee> program.
-
-It passes input received on STDIN through to STDOUT while also writing a copy
-of the input to any files provided as arguments. By default, files will be
-overwritten, but this behavior may be altered with the C<--append> option.
-
-Unlike C<tee>, C<ptee> does not support ignoring interrupts, as signal handling
-is not sufficiently portable.
-
-=head1 BUGS
-
-Please report any bugs or feature using the CPAN Request Tracker.
-Bugs can be submitted by email to C<bug-Tee@rt.cpan.org> or
-through the web interface at
-L<http:E<sol>E<sol>rt.cpan.orgE<sol>PublicE<sol>DistE<sol>Display.html?Name=Tee>
-
-When submitting a bug or request, please include a test-file or a patch to an
-existing test-file that illustrates the bug or desired feature.
-
-=head1 AUTHOR
-
-David A. Golden (DAGOLDEN)
-
-dagolden@cpan.org
-
-http:E<sol>E<sol>www.dagolden.orgE<sol>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright (c) 2006 by David A. Golden
-
-This program is free software; you can redistribute
-it andE<sol>or modify it under the same terms as Perl itself.
-
-The full text of the license can be found in the
-LICENSE file included with this module.
-
-=head1 DISCLAIMER OF WARRANTY
-
-BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS ANDE<sol>OR OTHER PARTIES
-PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
-EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
-ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
-YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
-NECESSARY SERVICING, REPAIR, OR CORRECTION.
-
-IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY ANDE<sol>OR
-REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
-LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
-OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
-THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-
-
@@ -0,0 +1,57 @@
+#!perl
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+
+use strict;
+use warnings;
+
+use Test::More;
+
+
+
+use File::Find;
+use File::Temp qw{ tempdir };
+
+my @modules;
+find(
+ sub {
+ return if $File::Find::name !~ /\.pm\z/;
+ my $found = $File::Find::name;
+ $found =~ s{^lib/}{};
+ $found =~ s{[/\\]}{::}g;
+ $found =~ s/\.pm$//;
+ # nothing to skip
+ push @modules, $found;
+ },
+ 'lib',
+);
+
+my @scripts = glob "bin/*";
+
+my $plan = scalar(@modules) + scalar(@scripts);
+$plan ? (plan tests => $plan) : (plan skip_all => "no tests to run");
+
+{
+ # fake home for cpan-testers
+ local $ENV{HOME} = tempdir( CLEANUP => 1 );
+
+ like( qx{ $^X -Ilib -e "require $_; print '$_ ok'" }, qr/^\s*$_ ok/s, "$_ loaded ok" )
+ for sort @modules;
+
+ SKIP: {
+ eval "use Test::Script 1.05; 1;";
+ skip "Test::Script needed to test script compilation", scalar(@scripts) if $@;
+ foreach my $file ( @scripts ) {
+ my $script = $file;
+ $script =~ s!.*/!!;
+ script_compiles( $file, "$script script compiles" );
+ }
+ }
+}
@@ -2,7 +2,8 @@
use strict;
use File::Spec;
use File::Temp;
-use IPC::Run3;
+use IO::CaptureOutput qw/ capture qxx /;
+use IO::File;
use Probe::Perl;
use Test::More;
use t::Expected;
@@ -17,87 +18,111 @@ select($stdout);
$|=1;
#--------------------------------------------------------------------------#
+# Declarations
+#--------------------------------------------------------------------------#
-plan tests => 9 ;
-
-my $perl = Probe::Perl->find_perl_interpreter;
+my $pp = Probe::Perl->new;
+my $perl = $pp->find_perl_interpreter;
my $hello = File::Spec->catfile(qw/t helloworld.pl/);
-my $tee = File::Spec->catfile(qw/scripts ptee/);
+my $tee = File::Spec->catfile(qw/bin ptee/);
my $tempfh = File::Temp->new;
+my $tempfh2 = File::Temp->new;
my $tempname = $tempfh->filename;
-my ($got_stdout, $got_stderr);
+my $tempname2 = $tempfh2->filename;
+my ($got_stdout, $got_stderr, $teed_stdout);
+
+my $stdout_regex = quotemeta(expected("STDOUT"));
+my $stderr_regex = quotemeta(expected("STDERR"));
+
+sub _slurp {
+ my $fh = IO::File->new(shift, "r");
+ local $/;
+ return scalar <$fh>;
+}
+
+#--------------------------------------------------------------------------#
+# Begin test plan
+#--------------------------------------------------------------------------#
+
+plan tests => 14 ;
+
+require_ok( "Tee" );
+Tee->import;
+
+can_ok( "main", "tee" );
ok( -r $hello,
"hello script readable"
);
-ok( -r $tee,
- "tee script readable"
-);
+# check direct output of helloworld
-# check direct output of hello world
-run3 "$perl $hello", undef, \$got_stdout, \$got_stderr;
+($got_stdout, $got_stderr) = qxx("$perl $hello");
-is( $got_stdout, expected("STDOUT"),
- "hello world program output (direct)"
+is( $got_stdout, expected("STDOUT"),
+ "system(CMD) script STDOUT"
+);
+is( $got_stderr, expected("STDERR"),
+ "system(CMD) script STDERR"
);
-# check output through ptee
+# check tee of STDOUT
truncate $tempfh, 0;
-run3 "$perl $hello | $perl $tee $tempname", undef, \$got_stdout, \$got_stderr;
-is( $got_stdout, expected("STDOUT"),
- "hello world program output (tee stdout)"
-);
-
-open FH, "< $tempname";
-$got_stdout = do { local $/; <FH> };
-close FH;
+($got_stdout, $got_stderr) = qxx("$perl $hello | $perl $tee $tempname");
-is( $got_stdout, expected("STDOUT"),
- "hello world program output (tee file)"
+is( $got_stdout, expected("STDOUT"),
+ "tee(CMD,FILE) script STDOUT"
+);
+is( $got_stderr, expected("STDERR"),
+ "tee(CMD,FILE) script STDERR"
);
-# check appended output
-run3 "$perl $hello | $perl $tee -a $tempname", undef, \$got_stdout, \$got_stderr;
+$teed_stdout = _slurp($tempname);
+is( $teed_stdout, expected("STDOUT"),
+ "tee(CMD,FILE) script tee file"
+);
-open FH, "< $tempname";
-$got_stdout = do { local $/; <FH> };
-close FH;
+## check tee of STDOUT to multiple files
+truncate $tempfh, 0;
+($got_stdout, $got_stderr) = qxx("$perl $hello | $perl $tee $tempname $tempname2");
-is( $got_stdout, expected("STDOUT") x 2,
- "hello world program output (tee -a)"
+$teed_stdout = _slurp($tempname);
+is( $teed_stdout, expected("STDOUT"),
+ "tee(CMD,FILE1,FILE2) script tee file (1)"
);
-run3 "$perl $hello | $perl $tee --append $tempname", undef, \$got_stdout, \$got_stderr;
-
-open FH, "< $tempname" or die "Can't open $tempname for reading";
+$teed_stdout = _slurp($tempname2);
+is( $teed_stdout, expected("STDOUT"),
+ "tee(CMD,FILE1,FILE2) script tee file (2)"
+);
-$got_stdout = do { local $/; <FH> };
-close FH;
+### check tee of both STDOUT and STDERR
+truncate $tempfh, 0;
+($got_stdout, $got_stderr) = qxx("$perl $hello 2>&1 | $perl $tee $tempname" );
+
+$teed_stdout = _slurp($tempname);
-is( $got_stdout, expected("STDOUT") x 3,
- "hello world program output (tee --append)"
+like( $teed_stdout, "/$stdout_regex/",
+ "tee(CMD,FILE) w/stderr script tee file (STDOUT)"
+);
+like( $teed_stdout, "/$stderr_regex/",
+ "tee(CMD,FILE) w/stderr script tee file (STDERR)"
);
-# check multiple files
-my $temp2 = File::Temp->new;
-truncate $tempfh, 0;
-run3 "$perl $hello | $perl $tee $tempname $temp2", undef, \$got_stdout, \$got_stderr;
-open FH, "< $tempname";
-$got_stdout = do { local $/; <FH> };
-close FH;
+### check tee of both with append
+($got_stdout, $got_stderr) = qxx("$perl $hello 2>&1 | $perl -- $tee --append $tempname" );
-is( $got_stdout, expected("STDOUT"),
- "hello world program output (tee file1 file2 [1])"
-);
+$teed_stdout = _slurp($tempname);
-open FH, "< $temp2";
-$got_stdout = do { local $/; <FH> };
-close FH;
+my $saw_stdout = () = ( $teed_stdout =~ /($stdout_regex)/gms );
+my $saw_stderr = () = ( $teed_stdout =~ /($stderr_regex)/gms );
-is( $got_stdout, expected("STDOUT"),
- "hello world program output (tee file1 file2 [2])"
+is( $saw_stdout, 2,
+ "tee(CMD,FILE) w/stderr+append script tee file (STDOUT)"
+);
+is( $saw_stderr, 2,
+ "tee(CMD,FILE) w/stderr+append script tee file (STDERR)"
);
@@ -2,7 +2,8 @@
use strict;
use File::Spec;
use File::Temp;
-use IPC::Run3;
+use IO::CaptureOutput qw/ capture qxx /;
+use IO::File;
use Probe::Perl;
use Test::More;
use t::Expected;
@@ -23,17 +24,28 @@ $|=1;
my $pp = Probe::Perl->new;
my $perl = $pp->find_perl_interpreter;
my $hello = File::Spec->catfile(qw/t helloworld.pl/);
+my $fatality = File::Spec->catfile(qw/t fatality.pl/);
my $tee = File::Spec->catfile(qw/scripts ptee/);
my $tempfh = File::Temp->new;
my $tempfh2 = File::Temp->new;
my $tempname = $tempfh->filename;
-my ($got_stdout, $got_stderr);
+my $tempname2 = $tempfh2->filename;
+my ($got_stdout, $got_stderr, $teed_stdout, $rc, $status);
+
+my $stdout_regex = quotemeta(expected("STDOUT"));
+my $stderr_regex = quotemeta(expected("STDERR"));
+
+sub _slurp {
+ my $fh = IO::File->new(shift, "r");
+ local $/;
+ return scalar <$fh>;
+}
#--------------------------------------------------------------------------#
# Begin test plan
#--------------------------------------------------------------------------#
-plan tests => 9 ;
+plan tests => 14 ;
require_ok( "Tee" );
Tee->import;
@@ -46,63 +58,81 @@ ok( -r $hello,
# check direct output of helloworld
-run3 "$perl $hello", undef, \$got_stdout, \$got_stderr;
+($got_stdout, $got_stderr) = qxx("$perl $hello");
is( $got_stdout, expected("STDOUT"),
- "hello world program output (direct)"
+ "system(CMD) script STDOUT"
+);
+is( $got_stderr, expected("STDERR"),
+ "system(CMD) script STDERR"
);
# check tee of STDOUT
truncate $tempfh, 0;
-tee("$perl $hello", $tempname);
-open FH, "< $tempname";
-$got_stdout = do { local $/; <FH> };
-close FH;
+capture {
+ $rc = tee("$perl $hello", $tempname)
+} \$got_stdout, \$got_stderr;
is( $got_stdout, expected("STDOUT"),
- "hello world program output (tee file)"
+ "tee(CMD,FILE) script STDOUT"
+);
+is( $got_stderr, expected("STDERR"),
+ "tee(CMD,FILE) script STDERR"
+);
+
+$teed_stdout = _slurp($tempname);
+is( $teed_stdout, expected("STDOUT"),
+ "tee(CMD,FILE) script tee file"
);
# check tee of STDOUT to multiple files
truncate $tempfh, 0;
-tee("$perl $hello", $tempname, $tempfh2);
+capture {
+ tee("$perl $hello", $tempname, $tempname2);
+} \$got_stdout, \$got_stderr;
-open FH, "< $tempname";
-$got_stdout = do { local $/; <FH> };
-close FH;
-is( $got_stdout, expected("STDOUT"),
- "hello world program output (tee file1 file2 [1])"
+$teed_stdout = _slurp($tempname);
+is( $teed_stdout, expected("STDOUT"),
+ "tee(CMD,FILE1,FILE2) script tee file (1)"
);
-open FH, "< $tempfh2";
-$got_stdout = do { local $/; <FH> };
-close FH;
-
-is( $got_stdout, expected("STDOUT"),
- "hello world program output (tee file1 file2 [2])"
+$teed_stdout = _slurp($tempname2);
+is( $teed_stdout, expected("STDOUT"),
+ "tee(CMD,FILE1,FILE2) script tee file (2)"
);
-# check tee of both STDOUT and STDERR
+## check tee of both STDOUT and STDERR
truncate $tempfh, 0;
-tee("$perl $hello", { stderr => 1 }, $tempname);
+capture {
+ tee("$perl $hello", { stderr => 1 }, $tempname);
+} \$got_stdout, \$got_stderr;
-open FH, "< $tempname";
-$got_stdout = do { local $/; <FH> };
-close FH;
+$teed_stdout = _slurp($tempname);
-is( $got_stdout, expected("STDOUT") . expected("STDERR"),
- "hello world program output (tee file with stderr)"
+like( $teed_stdout, "/$stdout_regex/",
+ "tee(CMD,FILE) w/stderr script tee file (STDOUT)"
);
+like( $teed_stdout, "/$stderr_regex/",
+ "tee(CMD,FILE) w/stderr script tee file (STDERR)"
+);
+
-# check tee of both with append
-tee("$perl $hello", { stderr => 1, append => 1 }, $tempname);
+## check tee of both with append
+capture {
+ tee("$perl $hello", { stderr => 1, append => 1 }, $tempname);
+} \$got_stdout, \$got_stderr;
-open FH, "< $tempname";
-$got_stdout = do { local $/; <FH> };
-close FH;
+$teed_stdout = _slurp($tempname);
-is( $got_stdout, (expected("STDOUT") . expected("STDERR")) x 2,
- "hello world program output (tee file with stderr and append)"
+my $saw_stdout = () = ( $teed_stdout =~ /($stdout_regex)/gms );
+my $saw_stderr = () = ( $teed_stdout =~ /($stderr_regex)/gms );
+
+is( $saw_stdout, 2,
+ "tee(CMD,FILE) w/stderr+append script tee file (STDOUT)"
+);
+is( $saw_stderr, 2,
+ "tee(CMD,FILE) w/stderr+append script tee file (STDERR)"
);
+
@@ -1,10 +0,0 @@
-use Test::More;
-plan skip_all => "Skipping author tests" if not $ENV{AUTHOR_TESTING};
-
-my $min_tp = 1.22;
-eval "use Test::Pod $min_tp";
-plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
-
-all_pod_files_ok();
-__END__
-use Test::Pod; # Fake CPANTS
@@ -1,22 +0,0 @@
-use Test::More;
-use Probe::Perl;
-plan skip_all => "Skipping author tests" if not $ENV{AUTHOR_TESTING};
-
-my $p = Probe::Perl->new;
-
-$ENV{PATH} = join( $p->config('path_sep'), 'scripts',
- split( $p->config('path_sep'), $ENV{PATH} ) );
-
-my $min_tpc = 1.08;
-eval "use Test::Pod::Coverage $min_tpc";
-plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
- if $@;
-
-my $min_pc = 0.17;
-eval "use Pod::Coverage $min_pc";
-plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
- if $@;
-
-all_pod_coverage_ok();
-__END__
-use Test::Pod::Coverage; # Fake CPANTS
@@ -1,3 +1,12 @@
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
package t::Expected;
@EXPORT = qw( expected );
@ISA = qw( Exporter );
@@ -0,0 +1,16 @@
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+select(STDERR);
+$|++;
+select(STDOUT);
+$|++;
+print STDOUT "# STDOUT: hello world\n";
+print STDERR "# STDERR: goodbye, cruel world\n";
+exit 1;
@@ -1,3 +1,12 @@
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
select(STDERR);
$|++;
select(STDOUT);
@@ -0,0 +1,16 @@
+#!perl
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+
+use Test::More;
+
+eval "use Test::CPAN::Meta";
+plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@;
+meta_yaml_ok();
@@ -0,0 +1,22 @@
+#!perl
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+
+use Test::More;
+
+eval "use Test::Pod::Coverage 1.08";
+plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
+ if $@;
+
+eval "use Pod::Coverage::TrustPod";
+plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
+ if $@;
+
+all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
@@ -0,0 +1,16 @@
+#!perl
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+use Test::More;
+
+eval "use Test::Pod 1.41";
+plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
+
+all_pod_files_ok();
@@ -0,0 +1,17 @@
+#!perl
+#
+# This file is part of Tee
+#
+# This software is Copyright (c) 2006 by David Golden.
+#
+# This is free software, licensed under:
+#
+# The Apache License, Version 2.0, January 2004
+#
+
+use Test::More;
+
+eval "use Test::Portability::Files";
+plan skip_all => "Test::Portability::Files required for testing portability"
+ if $@;
+run_tests();